using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_PHYSICIANMap : EntityTypeConfiguration<SO_PHYSICIAN>
    {
        public SO_PHYSICIANMap()
        {
            // Primary Key
            this.HasKey(t => new { t.ACCOUNT_, t.SumFields, t.DimFields });

            // Properties
            this.Property(t => t.ID)
                .HasMaxLength(6);

            this.Property(t => t.NAME)
                .HasMaxLength(50);

            this.Property(t => t.TYPE)
                .HasMaxLength(11);

            this.Property(t => t.LICENSE_NO)
                .HasMaxLength(15);

            this.Property(t => t.SPECIALTY)
                .HasMaxLength(30);

            this.Property(t => t.ACCOUNT_)
                .IsRequired()
                .HasMaxLength(40);

            this.Property(t => t.Currency)
                .HasMaxLength(5);

            this.Property(t => t.Fees_plan)
                .HasMaxLength(50);

            this.Property(t => t.Referral_plan)
                .HasMaxLength(50);

            this.Property(t => t.SumFields)
                .IsRequired()
                .HasMaxLength(1);

            this.Property(t => t.DimFields)
                .IsRequired()
                .HasMaxLength(1);

            this.Property(t => t.Code)
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("SO_PHYSICIAN");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.NAME).HasColumnName("NAME");
            this.Property(t => t.TYPE).HasColumnName("TYPE");
            this.Property(t => t.LICENSE_NO).HasColumnName("LICENSE_NO");
            this.Property(t => t.SPECIALTY).HasColumnName("SPECIALTY");
            this.Property(t => t.ACCOUNT_).HasColumnName("ACCOUNT#");
            this.Property(t => t.Currency).HasColumnName("Currency");
            this.Property(t => t.Fees_plan).HasColumnName("Fees_plan");
            this.Property(t => t.Referral_plan).HasColumnName("Referral_plan");
            this.Property(t => t.SumFields).HasColumnName("SumFields");
            this.Property(t => t.DimFields).HasColumnName("DimFields");
            this.Property(t => t.Code).HasColumnName("Code");
        }
    }
}
